<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\modules\clinical\models\GeneInfo;

/* @var $this yii\web\View */
/* @var $model app\models\GeneReport */

$this->registerJsFile('@web/js/gene.js', ['depends' => 'app\assets\AppAsset']);
$pdfurl = '/upload/pdf/'.$model->pk_id.'.pdf';
$count = 0;
?>
<div class="gene-report-create">

    <div class="gene-report-form myForm">

    <div class="alert alert-danger" id="error-msg"></div>

	    <?php $form = ActiveForm::begin([
	    	'id' => 'geneForm',
        	'method' => 'post',
        	'action' => $model->isNewRecord ? '/clinical/gene/create' : 'update?id='.$model->pk_id,
	    	'options' => ['enctype' => 'multipart/form-data']
	    ]);?>

		<div class="form-group">
			<?= Html::label('患者姓名', 'pt_rel') ?><br />
			<?= Html::dropDownList('pt_rel', !empty($pt_rel) ? $pt_rel : 0, $pt_rel_list, ($model->isNewRecord) ? ['class' => 'pt_rel_list'] : ['class' => 'pt_rel_list', 'disabled' => 'true']) ?>
		</div>

	    <?= $form->field($model, 'charge_name')->textInput(['maxlength' => true])->error(false) ?>

	    <?= $form->field($model, 'rp_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?><br />

	    <?= $form->field($model, 'ck_comp')->dropDownList(GeneInfo::getParams('deliver_comp'))->error(false) ?>

	    <?= $form->field($model, 'ck_program')->textInput(['maxlength' => true])->error(false) ?>

	    <?= $form->field($model, 'ck_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?><br />

	    <?= $form->field($model, 'disc_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?>

	    <?= $form->field($model, 'recheck_time')->textInput(['class'=>'form-control laydate-icon date'])->error(false) ?>

	    <?= $form->field($model, 'isSent')->dropDownList(GeneInfo::getParams('recheck')) ?><br />

	    <?= $form->field($model, 'ck_result', ['labelOptions' => ['class' => 'lg_area']])->textarea(['maxlength' => true])->error(false) ?><br />

	    <?= $form->field($model, 'disc_result', ['labelOptions' => ['class' => 'lg_area']])->textarea(['maxlength' => true])->error(false) ?><br />

    	<?= $form->field($model, 'pdfFile')->fileInput() ?>

    	<?php if (file_exists('../web/'.$pdfurl)) :?>
    		<div>
    			<font color="red">* 已上传过文件，继续上传将覆盖已上传的文件</font><br />
    			点击查看 <?= Html::a('<i class="fa fa-file-pdf-o"></i>', $pdfurl, ['target'=>'_blank']); ?>
    		</div>
    	<?php endif; ?><br />

	    <input type="hidden" id="status" value="<?= $model->isNewRecord ? 'create' : 'update/'.$model->pk_id ?>">
	    <div class="form-group">
	        <?= Html::submitButton($model->isNewRecord ? '保存' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'id' => 'submitButton']) ?>

          <?= Html::a('取消', ['/clinical/gene'], ['class' => 'btn btn-success']) ?>
	    </div>

	    <?php ActiveForm::end(); ?>

		</div>

</div>
